<!DOCTYPE html>
<html>
<head>
    <title>检查历史记录</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-4">
      <div class="container">
        <a class="navbar-brand" href="{{ url_for('index') }}">数据库监控</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
          <ul class="navbar-nav">
            <li class="nav-item">
              <a class="nav-link" href="{{ url_for('index') }}">实时状态</a>
            </li>
            <li class="nav-item">
              <a class="nav-link active" href="{{ url_for('history') }}">历史记录</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="{{ url_for('failures') }}">失败记录</a>
            </li>
          </ul>
        </div>
      </div>
    </nav>
    <div class="container mt-4">
        <h2>历史检查记录</h2>
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>数据库</th>
                    <th>状态</th>
                    <th>检查时间</th>
                    <th>详情</th>
                </tr>
            </thead>
            <tbody>
                {% for record in records %}
                <tr class="{{ 'table-danger' if '失败' in record[2] else '' }}">
                    <td>{{ record[0] }}</td>
                    <td>{{ record[1] }}</td>
                    <td>{{ record[2] }}</td>
                    <td>{{ record[3]|default('', true) }}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</body>
</html>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>